package com.dq.controller.op.opboss.finance;

import com.dq.exception.customException.AdminException;
import com.dq.controller.in.BasePayQuery;
import com.dq.vo.Vo;

import com.dq.domain.sys.section.SysSection;
import com.dq.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @Author luchangtong
 * @Date 2019/12/21 17:30
 */
@RestController
@RequestMapping("/sys/boss/basePaySet")
@Api(description = "基本工资管理")
public class BossBasePaySetController extends AllService {

    @ApiOperation("列表")
    @PostMapping("list")
    public Vo list(@RequestBody BasePayQuery basePayQuery)throws AdminException{
        return basePaySetRecordService.list(basePayQuery);
    }

    @ApiOperation("添加")
    @PostMapping("/add/{staffUserId}/{baseSalary}")
    public Vo add(@PathVariable Long staffUserId, @PathVariable BigDecimal baseSalary)throws AdminException{
        SysSection section = shiroService.getDept();
        return basePaySetRecordService.add(baseSalary,section.getId(),staffUserId);
    }

    @ApiOperation("编辑")
    @PostMapping("/edit/{staffUserId}/{baseSalary}")
    public Vo edit(@PathVariable Long staffUserId, @PathVariable BigDecimal baseSalary) throws AdminException{
        SysSection section = shiroService.getDept();
        return basePaySetRecordService.edit(baseSalary, section.getId(),staffUserId);
    }

    @ApiOperation("删除")
    @PostMapping("/delete/{id}")
    public Vo delete(@PathVariable Long id)throws AdminException{
        return basePaySetRecordService.delete(id);
    }
}
